const errcode = require('../utils/errcode')

module.exports = async (ctx, next) => {
  try {
    await next()
  } catch (err) {
    console.error(err)
    ctx.body = {
      ret: errcode.HANDLE_ERROR.ret,
      msg: errcode.HANDLE_ERROR.msg,
      description: err.message
    }
  }
}
